package org.shangrila.bme.eo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;


/**
 * The persistent class for the bme_purch_order database table.
 * 
 */
@Entity
@Table(name="bme_purch_order")
@NamedQuery(name="BmePurchOrder.findAll", query="SELECT b FROM BmePurchOrder b")
public class BmePurchOrder implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String id;

	private BigDecimal amount;

	@Column(name="SHIPPED_AMOUNT")
	private BigDecimal shippedAmount;
	
	@Column(name="UNSHIPPED_AMOUNT")
	private BigDecimal unshippedAmount;
		
	@Column(name="ANNEX_FLAG")
	private int annexFlag;

	private String consignee;

	@Column(name="CONT_NAME")
	private String contName;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="CREATE_TIME")
	private Date createTime;

	private String operator;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="ORDER_DATE")
	private Date orderDate;

	private String phone;

	
	private String remarks;

	@Column(name="SHIPPING_ADDRESS")
	private String shippingAddress;
	
	private String status;

	//bi-directional many-to-one association to BmePurchDetail
	@OneToMany(mappedBy="bmePurchOrder")
	private List<BmePurchDetail> bmePurchDetails;

	//bi-directional many-to-one association to BmeContract
	@ManyToOne
	@JoinColumn(name="CONT_ID")
	private BmeContract bmeContract;

	//bi-directional many-to-one association to BmeSupplier
	@ManyToOne
	@JoinColumn(name="SUPPLIER_ID")
	private BmeSupplier bmeSupplier;

	//bi-directional many-to-one association to BmeReceipt
	@OneToMany(mappedBy="bmePurchOrder")
	private List<BmeReceipt> bmeReceipts;

	public BmePurchOrder() {
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public BigDecimal getAmount() {
		return this.amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public BigDecimal getShippedAmount() {
		return shippedAmount;
	}

	public void setShippedAmount(BigDecimal shippedAmount) {
		this.shippedAmount = shippedAmount;
	}

	public BigDecimal getUnshippedAmount() {
		return unshippedAmount;
	}

	public void setUnshippedAmount(BigDecimal unshippedAmount) {
		this.unshippedAmount = unshippedAmount;
	}

	public int getAnnexFlag() {
		return this.annexFlag;
	}

	public void setAnnexFlag(int annexFlag) {
		this.annexFlag = annexFlag;
	}

	public String getConsignee() {
		return this.consignee;
	}

	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}

	public String getContName() {
		return this.contName;
	}

	public void setContName(String contName) {
		this.contName = contName;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getOperator() {
		return this.operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public Date getOrderDate() {
		return this.orderDate;
	}

	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}

	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getRemarks() {
		return this.remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getShippingAddress() {
		return this.shippingAddress;
	}

	public void setShippingAddress(String shippingAddress) {
		this.shippingAddress = shippingAddress;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public List<BmePurchDetail> getBmePurchDetails() {
		return this.bmePurchDetails;
	}

	public void setBmePurchDetails(List<BmePurchDetail> bmePurchDetails) {
		this.bmePurchDetails = bmePurchDetails;
	}

	public BmePurchDetail addBmePurchDetail(BmePurchDetail bmePurchDetail) {
		getBmePurchDetails().add(bmePurchDetail);
		bmePurchDetail.setBmePurchOrder(this);

		return bmePurchDetail;
	}

	public BmePurchDetail removeBmePurchDetail(BmePurchDetail bmePurchDetail) {
		getBmePurchDetails().remove(bmePurchDetail);
		bmePurchDetail.setBmePurchOrder(null);

		return bmePurchDetail;
	}

	public BmeContract getBmeContract() {
		return this.bmeContract;
	}

	public void setBmeContract(BmeContract bmeContract) {
		this.bmeContract = bmeContract;
	}

	public BmeSupplier getBmeSupplier() {
		return this.bmeSupplier;
	}

	public void setBmeSupplier(BmeSupplier bmeSupplier) {
		this.bmeSupplier = bmeSupplier;
	}

	public List<BmeReceipt> getBmeReceipts() {
		return this.bmeReceipts;
	}

	public void setBmeReceipts(List<BmeReceipt> bmeReceipts) {
		this.bmeReceipts = bmeReceipts;
	}

	public BmeReceipt addBmeReceipt(BmeReceipt bmeReceipt) {
		getBmeReceipts().add(bmeReceipt);
		bmeReceipt.setBmePurchOrder(this);

		return bmeReceipt;
	}

	public BmeReceipt removeBmeReceipt(BmeReceipt bmeReceipt) {
		getBmeReceipts().remove(bmeReceipt);
		bmeReceipt.setBmePurchOrder(null);

		return bmeReceipt;
	}

}